home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Programming / gcc-2.95.3-3 / info / gcc.info-25 < prev    next >
Encoding:
GNU Info File  |  2001-07-15  |  44.5 KB  |  981 lines

  1. This is Info file gcc.info, produced by Makeinfo version 1.68 from the
  2. input file ./gcc.texi.
  3.  
  4. INFO-DIR-SECTION Programming
  5. START-INFO-DIR-ENTRY
  6. * gcc: (gcc).                  The GNU Compiler Collection.
  7. END-INFO-DIR-ENTRY
  8.    This file documents the use and the internals of the GNU compiler.
  9.  
  10.    Published by the Free Software Foundation 59 Temple Place - Suite 330
  11. Boston, MA 02111-1307 USA
  12.  
  13.    Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
  14. 1999, 2000 Free Software Foundation, Inc.
  15.  
  16.    Permission is granted to make and distribute verbatim copies of this
  17. manual provided the copyright notice and this permission notice are
  18. preserved on all copies.
  19.  
  20.    Permission is granted to copy and distribute modified versions of
  21. this manual under the conditions for verbatim copying, provided also
  22. that the sections entitled "GNU General Public License" and "Funding
  23. for Free Software" are included exactly as in the original, and
  24. provided that the entire resulting derived work is distributed under
  25. the terms of a permission notice identical to this one.
  26.  
  27.    Permission is granted to copy and distribute translations of this
  28. manual into another language, under the above conditions for modified
  29. versions, except that the sections entitled "GNU General Public
  30. License" and "Funding for Free Software", and this permission notice,
  31. may be included in translations approved by the Free Software Foundation
  32. instead of in the original English.
  33.  
  34. 
  35. File: gcc.info,  Node: Trampolines,  Next: Library Calls,  Prev: Varargs,  Up: Target Macros
  36.  
  37. Trampolines for Nested Functions
  38. ================================
  39.  
  40.    A "trampoline" is a small piece of code that is created at run time
  41. when the address of a nested function is taken.  It normally resides on
  42. the stack, in the stack frame of the containing function.  These macros
  43. tell GNU CC how to generate code to allocate and initialize a
  44. trampoline.
  45.  
  46.    The instructions in the trampoline must do two things: load a
  47. constant address into the static chain register, and jump to the real
  48. address of the nested function.  On CISC machines such as the m68k,
  49. this requires two instructions, a move immediate and a jump.  Then the
  50. two addresses exist in the trampoline as word-long immediate operands.
  51. On RISC machines, it is often necessary to load each address into a
  52. register in two parts.  Then pieces of each address form separate
  53. immediate operands.
  54.  
  55.    The code generated to initialize the trampoline must store the
  56. variable parts--the static chain value and the function address--into
  57. the immediate operands of the instructions.  On a CISC machine, this is
  58. simply a matter of copying each address to a memory reference at the
  59. proper offset from the start of the trampoline.  On a RISC machine, it
  60. may be necessary to take out pieces of the address and store them
  61. separately.
  62.  
  63. `TRAMPOLINE_TEMPLATE (FILE)'
  64.      A C statement to output, on the stream FILE, assembler code for a
  65.      block of data that contains the constant parts of a trampoline.
  66.      This code should not include a label--the label is taken care of
  67.      automatically.
  68.  
  69.      If you do not define this macro, it means no template is needed
  70.      for the target.  Do not define this macro on systems where the
  71.      block move code to copy the trampoline into place would be larger
  72.      than the code to generate it on the spot.
  73.  
  74. `TRAMPOLINE_SECTION'
  75.      The name of a subroutine to switch to the section in which the
  76.      trampoline template is to be placed (*note Sections::.).  The
  77.      default is a value of `readonly_data_section', which places the
  78.      trampoline in the section containing read-only data.
  79.  
  80. `TRAMPOLINE_SIZE'
  81.      A C expression for the size in bytes of the trampoline, as an
  82.      integer.
  83.  
  84. `TRAMPOLINE_ALIGNMENT'
  85.      Alignment required for trampolines, in bits.
  86.  
  87.      If you don't define this macro, the value of `BIGGEST_ALIGNMENT'
  88.      is used for aligning trampolines.
  89.  
  90. `INITIALIZE_TRAMPOLINE (ADDR, FNADDR, STATIC_CHAIN)'
  91.      A C statement to initialize the variable parts of a trampoline.
  92.      ADDR is an RTX for the address of the trampoline; FNADDR is an RTX
  93.      for the address of the nested function; STATIC_CHAIN is an RTX for
  94.      the static chain value that should be passed to the function when
  95.      it is called.
  96.  
  97. `ALLOCATE_TRAMPOLINE (FP)'
  98.      A C expression to allocate run-time space for a trampoline.  The
  99.      expression value should be an RTX representing a memory reference
  100.      to the space for the trampoline.
  101.  
  102.      If this macro is not defined, by default the trampoline is
  103.      allocated as a stack slot.  This default is right for most
  104.      machines.  The exceptions are machines where it is impossible to
  105.      execute instructions in the stack area.  On such machines, you may
  106.      have to implement a separate stack, using this macro in
  107.      conjunction with `FUNCTION_PROLOGUE' and `FUNCTION_EPILOGUE'.
  108.  
  109.      FP points to a data structure, a `struct function', which
  110.      describes the compilation status of the immediate containing
  111.      function of the function which the trampoline is for.  Normally
  112.      (when `ALLOCATE_TRAMPOLINE' is not defined), the stack slot for the
  113.      trampoline is in the stack frame of this containing function.
  114.      Other allocation strategies probably must do something analogous
  115.      with this information.
  116.  
  117.    Implementing trampolines is difficult on many machines because they
  118. have separate instruction and data caches.  Writing into a stack
  119. location fails to clear the memory in the instruction cache, so when
  120. the program jumps to that location, it executes the old contents.
  121.  
  122.    Here are two possible solutions.  One is to clear the relevant parts
  123. of the instruction cache whenever a trampoline is set up.  The other is
  124. to make all trampolines identical, by having them jump to a standard
  125. subroutine.  The former technique makes trampoline execution faster; the
  126. latter makes initialization faster.
  127.  
  128.    To clear the instruction cache when a trampoline is initialized,
  129. define the following macros which describe the shape of the cache.
  130.  
  131. `INSN_CACHE_SIZE'
  132.      The total size in bytes of the cache.
  133.  
  134. `INSN_CACHE_LINE_WIDTH'
  135.      The length in bytes of each cache line.  The cache is divided into
  136.      cache lines which are disjoint slots, each holding a contiguous
  137.      chunk of data fetched from memory.  Each time data is brought into
  138.      the cache, an entire line is read at once.  The data loaded into a
  139.      cache line is always aligned on a boundary equal to the line size.
  140.  
  141. `INSN_CACHE_DEPTH'
  142.      The number of alternative cache lines that can hold any particular
  143.      memory location.
  144.  
  145.    Alternatively, if the machine has system calls or instructions to
  146. clear the instruction cache directly, you can define the following
  147. macro.
  148.  
  149. `CLEAR_INSN_CACHE (BEG, END)'
  150.      If defined, expands to a C expression clearing the *instruction
  151.      cache* in the specified interval.  If it is not defined, and the
  152.      macro INSN_CACHE_SIZE is defined, some generic code is generated
  153.      to clear the cache.  The definition of this macro would typically
  154.      be a series of `asm' statements.  Both BEG and END are both pointer
  155.      expressions.
  156.  
  157.    To use a standard subroutine, define the following macro.  In
  158. addition, you must make sure that the instructions in a trampoline fill
  159. an entire cache line with identical instructions, or else ensure that
  160. the beginning of the trampoline code is always aligned at the same
  161. point in its cache line.  Look in `m68k.h' as a guide.
  162.  
  163. `TRANSFER_FROM_TRAMPOLINE'
  164.      Define this macro if trampolines need a special subroutine to do
  165.      their work.  The macro should expand to a series of `asm'
  166.      statements which will be compiled with GNU CC.  They go in a
  167.      library function named `__transfer_from_trampoline'.
  168.  
  169.      If you need to avoid executing the ordinary prologue code of a
  170.      compiled C function when you jump to the subroutine, you can do so
  171.      by placing a special label of your own in the assembler code.  Use
  172.      one `asm' statement to generate an assembler label, and another to
  173.      make the label global.  Then trampolines can use that label to
  174.      jump directly to your special assembler code.
  175.  
  176. 
  177. File: gcc.info,  Node: Library Calls,  Next: Addressing Modes,  Prev: Trampolines,  Up: Target Macros
  178.  
  179. Implicit Calls to Library Routines
  180. ==================================
  181.  
  182.    Here is an explanation of implicit calls to library routines.
  183.  
  184. `MULSI3_LIBCALL'
  185.      A C string constant giving the name of the function to call for
  186.      multiplication of one signed full-word by another.  If you do not
  187.      define this macro, the default name is used, which is `__mulsi3',
  188.      a function defined in `libgcc.a'.
  189.  
  190. `DIVSI3_LIBCALL'
  191.      A C string constant giving the name of the function to call for
  192.      division of one signed full-word by another.  If you do not define
  193.      this macro, the default name is used, which is `__divsi3', a
  194.      function defined in `libgcc.a'.
  195.  
  196. `UDIVSI3_LIBCALL'
  197.      A C string constant giving the name of the function to call for
  198.      division of one unsigned full-word by another.  If you do not
  199.      define this macro, the default name is used, which is `__udivsi3',
  200.      a function defined in `libgcc.a'.
  201.  
  202. `MODSI3_LIBCALL'
  203.      A C string constant giving the name of the function to call for the
  204.      remainder in division of one signed full-word by another.  If you
  205.      do not define this macro, the default name is used, which is
  206.      `__modsi3', a function defined in `libgcc.a'.
  207.  
  208. `UMODSI3_LIBCALL'
  209.      A C string constant giving the name of the function to call for the
  210.      remainder in division of one unsigned full-word by another.  If
  211.      you do not define this macro, the default name is used, which is
  212.      `__umodsi3', a function defined in `libgcc.a'.
  213.  
  214. `MULDI3_LIBCALL'
  215.      A C string constant giving the name of the function to call for
  216.      multiplication of one signed double-word by another.  If you do not
  217.      define this macro, the default name is used, which is `__muldi3',
  218.      a function defined in `libgcc.a'.
  219.  
  220. `DIVDI3_LIBCALL'
  221.      A C string constant giving the name of the function to call for
  222.      division of one signed double-word by another.  If you do not
  223.      define this macro, the default name is used, which is `__divdi3', a
  224.      function defined in `libgcc.a'.
  225.  
  226. `UDIVDI3_LIBCALL'
  227.      A C string constant giving the name of the function to call for
  228.      division of one unsigned full-word by another.  If you do not
  229.      define this macro, the default name is used, which is `__udivdi3',
  230.      a function defined in `libgcc.a'.
  231.  
  232. `MODDI3_LIBCALL'
  233.      A C string constant giving the name of the function to call for the
  234.      remainder in division of one signed double-word by another.  If
  235.      you do not define this macro, the default name is used, which is
  236.      `__moddi3', a function defined in `libgcc.a'.
  237.  
  238. `UMODDI3_LIBCALL'
  239.      A C string constant giving the name of the function to call for the
  240.      remainder in division of one unsigned full-word by another.  If
  241.      you do not define this macro, the default name is used, which is
  242.      `__umoddi3', a function defined in `libgcc.a'.
  243.  
  244. `INIT_TARGET_OPTABS'
  245.      Define this macro as a C statement that declares additional library
  246.      routines renames existing ones. `init_optabs' calls this macro
  247.      after initializing all the normal library routines.
  248.  
  249. `TARGET_EDOM'
  250.      The value of `EDOM' on the target machine, as a C integer constant
  251.      expression.  If you don't define this macro, GNU CC does not
  252.      attempt to deposit the value of `EDOM' into `errno' directly.
  253.      Look in `/usr/include/errno.h' to find the value of `EDOM' on your
  254.      system.
  255.  
  256.      If you do not define `TARGET_EDOM', then compiled code reports
  257.      domain errors by calling the library function and letting it
  258.      report the error.  If mathematical functions on your system use
  259.      `matherr' when there is an error, then you should leave
  260.      `TARGET_EDOM' undefined so that `matherr' is used normally.
  261.  
  262. `GEN_ERRNO_RTX'
  263.      Define this macro as a C expression to create an rtl expression
  264.      that refers to the global "variable" `errno'.  (On certain systems,
  265.      `errno' may not actually be a variable.)  If you don't define this
  266.      macro, a reasonable default is used.
  267.  
  268. `TARGET_MEM_FUNCTIONS'
  269.      Define this macro if GNU CC should generate calls to the System V
  270.      (and ANSI C) library functions `memcpy' and `memset' rather than
  271.      the BSD functions `bcopy' and `bzero'.
  272.  
  273. `LIBGCC_NEEDS_DOUBLE'
  274.      Define this macro if only `float' arguments cannot be passed to
  275.      library routines (so they must be converted to `double').  This
  276.      macro affects both how library calls are generated and how the
  277.      library routines in `libgcc1.c' accept their arguments.  It is
  278.      useful on machines where floating and fixed point arguments are
  279.      passed differently, such as the i860.
  280.  
  281. `FLOAT_ARG_TYPE'
  282.      Define this macro to override the type used by the library
  283.      routines to pick up arguments of type `float'.  (By default, they
  284.      use a union of `float' and `int'.)
  285.  
  286.      The obvious choice would be `float'--but that won't work with
  287.      traditional C compilers that expect all arguments declared as
  288.      `float' to arrive as `double'.  To avoid this conversion, the
  289.      library routines ask for the value as some other type and then
  290.      treat it as a `float'.
  291.  
  292.      On some systems, no other type will work for this.  For these
  293.      systems, you must use `LIBGCC_NEEDS_DOUBLE' instead, to force
  294.      conversion of the values `double' before they are passed.
  295.  
  296. `FLOATIFY (PASSED-VALUE)'
  297.      Define this macro to override the way library routines redesignate
  298.      a `float' argument as a `float' instead of the type it was passed
  299.      as.  The default is an expression which takes the `float' field of
  300.      the union.
  301.  
  302. `FLOAT_VALUE_TYPE'
  303.      Define this macro to override the type used by the library
  304.      routines to return values that ought to have type `float'.  (By
  305.      default, they use `int'.)
  306.  
  307.      The obvious choice would be `float'--but that won't work with
  308.      traditional C compilers gratuitously convert values declared as
  309.      `float' into `double'.
  310.  
  311. `INTIFY (FLOAT-VALUE)'
  312.      Define this macro to override the way the value of a
  313.      `float'-returning library routine should be packaged in order to
  314.      return it.  These functions are actually declared to return type
  315.      `FLOAT_VALUE_TYPE' (normally `int').
  316.  
  317.      These values can't be returned as type `float' because traditional
  318.      C compilers would gratuitously convert the value to a `double'.
  319.  
  320.      A local variable named `intify' is always available when the macro
  321.      `INTIFY' is used.  It is a union of a `float' field named `f' and
  322.      a field named `i' whose type is `FLOAT_VALUE_TYPE' or `int'.
  323.  
  324.      If you don't define this macro, the default definition works by
  325.      copying the value through that union.
  326.  
  327. `nongcc_SI_type'
  328.      Define this macro as the name of the data type corresponding to
  329.      `SImode' in the system's own C compiler.
  330.  
  331.      You need not define this macro if that type is `long int', as it
  332.      usually is.
  333.  
  334. `nongcc_word_type'
  335.      Define this macro as the name of the data type corresponding to the
  336.      word_mode in the system's own C compiler.
  337.  
  338.      You need not define this macro if that type is `long int', as it
  339.      usually is.
  340.  
  341. `perform_...'
  342.      Define these macros to supply explicit C statements to carry out
  343.      various arithmetic operations on types `float' and `double' in the
  344.      library routines in `libgcc1.c'.  See that file for a full list of
  345.      these macros and their arguments.
  346.  
  347.      On most machines, you don't need to define any of these macros,
  348.      because the C compiler that comes with the system takes care of
  349.      doing them.
  350.  
  351. `NEXT_OBJC_RUNTIME'
  352.      Define this macro to generate code for Objective C message sending
  353.      using the calling convention of the NeXT system.  This calling
  354.      convention involves passing the object, the selector and the
  355.      method arguments all at once to the method-lookup library function.
  356.  
  357.      The default calling convention passes just the object and the
  358.      selector to the lookup function, which returns a pointer to the
  359.      method.
  360.  
  361. 
  362. File: gcc.info,  Node: Addressing Modes,  Next: Condition Code,  Prev: Library Calls,  Up: Target Macros
  363.  
  364. Addressing Modes
  365. ================
  366.  
  367.    This is about addressing modes.
  368.  
  369. `HAVE_POST_INCREMENT'
  370.      A C expression that is nonzero the machine supports post-increment
  371.      addressing.
  372.  
  373. `HAVE_PRE_INCREMENT'
  374. `HAVE_POST_DECREMENT'
  375. `HAVE_PRE_DECREMENT'
  376.      Similar for other kinds of addressing.
  377.  
  378. `CONSTANT_ADDRESS_P (X)'
  379.      A C expression that is 1 if the RTX X is a constant which is a
  380.      valid address.  On most machines, this can be defined as
  381.      `CONSTANT_P (X)', but a few machines are more restrictive in which
  382.      constant addresses are supported.
  383.  
  384.      `CONSTANT_P' accepts integer-values expressions whose values are
  385.      not explicitly known, such as `symbol_ref', `label_ref', and
  386.      `high' expressions and `const' arithmetic expressions, in addition
  387.      to `const_int' and `const_double' expressions.
  388.  
  389. `MAX_REGS_PER_ADDRESS'
  390.      A number, the maximum number of registers that can appear in a
  391.      valid memory address.  Note that it is up to you to specify a
  392.      value equal to the maximum number that `GO_IF_LEGITIMATE_ADDRESS'
  393.      would ever accept.
  394.  
  395. `GO_IF_LEGITIMATE_ADDRESS (MODE, X, LABEL)'
  396.      A C compound statement with a conditional `goto LABEL;' executed
  397.      if X (an RTX) is a legitimate memory address on the target machine
  398.      for a memory operand of mode MODE.
  399.  
  400.      It usually pays to define several simpler macros to serve as
  401.      subroutines for this one.  Otherwise it may be too complicated to
  402.      understand.
  403.  
  404.      This macro must exist in two variants: a strict variant and a
  405.      non-strict one.  The strict variant is used in the reload pass.  It
  406.      must be defined so that any pseudo-register that has not been
  407.      allocated a hard register is considered a memory reference.  In
  408.      contexts where some kind of register is required, a pseudo-register
  409.      with no hard register must be rejected.
  410.  
  411.      The non-strict variant is used in other passes.  It must be
  412.      defined to accept all pseudo-registers in every context where some
  413.      kind of register is required.
  414.  
  415.      Compiler source files that want to use the strict variant of this
  416.      macro define the macro `REG_OK_STRICT'.  You should use an `#ifdef
  417.      REG_OK_STRICT' conditional to define the strict variant in that
  418.      case and the non-strict variant otherwise.
  419.  
  420.      Subroutines to check for acceptable registers for various purposes
  421.      (one for base registers, one for index registers, and so on) are
  422.      typically among the subroutines used to define
  423.      `GO_IF_LEGITIMATE_ADDRESS'.  Then only these subroutine macros
  424.      need have two variants; the higher levels of macros may be the
  425.      same whether strict or not.
  426.  
  427.      Normally, constant addresses which are the sum of a `symbol_ref'
  428.      and an integer are stored inside a `const' RTX to mark them as
  429.      constant.  Therefore, there is no need to recognize such sums
  430.      specifically as legitimate addresses.  Normally you would simply
  431.      recognize any `const' as legitimate.
  432.  
  433.      Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant
  434.      sums that are not marked with  `const'.  It assumes that a naked
  435.      `plus' indicates indexing.  If so, then you *must* reject such
  436.      naked constant sums as illegitimate addresses, so that none of
  437.      them will be given to `PRINT_OPERAND_ADDRESS'.
  438.  
  439.      On some machines, whether a symbolic address is legitimate depends
  440.      on the section that the address refers to.  On these machines,
  441.      define the macro `ENCODE_SECTION_INFO' to store the information
  442.      into the `symbol_ref', and then check for it here.  When you see a
  443.      `const', you will have to look inside it to find the `symbol_ref'
  444.      in order to determine the section.  *Note Assembler Format::.
  445.  
  446.      The best way to modify the name string is by adding text to the
  447.      beginning, with suitable punctuation to prevent any ambiguity.
  448.      Allocate the new name in `saveable_obstack'.  You will have to
  449.      modify `ASM_OUTPUT_LABELREF' to remove and decode the added text
  450.      and output the name accordingly, and define `STRIP_NAME_ENCODING'
  451.      to access the original name string.
  452.  
  453.      You can check the information stored here into the `symbol_ref' in
  454.      the definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and
  455.      `PRINT_OPERAND_ADDRESS'.
  456.  
  457. `REG_OK_FOR_BASE_P (X)'
  458.      A C expression that is nonzero if X (assumed to be a `reg' RTX) is
  459.      valid for use as a base register.  For hard registers, it should
  460.      always accept those which the hardware permits and reject the
  461.      others.  Whether the macro accepts or rejects pseudo registers
  462.      must be controlled by `REG_OK_STRICT' as described above.  This
  463.      usually requires two variant definitions, of which `REG_OK_STRICT'
  464.      controls the one actually used.
  465.  
  466. `REG_MODE_OK_FOR_BASE_P (X, MODE)'
  467.      A C expression that is just like `REG_OK_FOR_BASE_P', except that
  468.      that expression may examine the mode of the memory reference in
  469.      MODE.  You should define this macro if the mode of the memory
  470.      reference affects whether a register may be used as a base
  471.      register.  If you define this macro, the compiler will use it
  472.      instead of `REG_OK_FOR_BASE_P'.
  473.  
  474. `REG_OK_FOR_INDEX_P (X)'
  475.      A C expression that is nonzero if X (assumed to be a `reg' RTX) is
  476.      valid for use as an index register.
  477.  
  478.      The difference between an index register and a base register is
  479.      that the index register may be scaled.  If an address involves the
  480.      sum of two registers, neither one of them scaled, then either one
  481.      may be labeled the "base" and the other the "index"; but whichever
  482.      labeling is used must fit the machine's constraints of which
  483.      registers may serve in each capacity.  The compiler will try both
  484.      labelings, looking for one that is valid, and will reload one or
  485.      both registers only if neither labeling works.
  486.  
  487. `LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN)'
  488.      A C compound statement that attempts to replace X with a valid
  489.      memory address for an operand of mode MODE.  WIN will be a C
  490.      statement label elsewhere in the code; the macro definition may use
  491.  
  492.           GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN);
  493.  
  494.      to avoid further processing if the address has become legitimate.
  495.  
  496.      X will always be the result of a call to `break_out_memory_refs',
  497.      and OLDX will be the operand that was given to that function to
  498.      produce X.
  499.  
  500.      The code generated by this macro should not alter the substructure
  501.      of X.  If it transforms X into a more legitimate form, it should
  502.      assign X (which will always be a C variable) a new value.
  503.  
  504.      It is not necessary for this macro to come up with a legitimate
  505.      address.  The compiler has standard ways of doing so in all cases.
  506.      In fact, it is safe for this macro to do nothing.  But often a
  507.      machine-dependent strategy can generate better code.
  508.  
  509. `LEGITIMIZE_RELOAD_ADDRESS (X, MODE, OPNUM, TYPE, IND_LEVELS, WIN)'
  510.      A C compound statement that attempts to replace X, which is an
  511.      address that needs reloading, with a valid memory address for an
  512.      operand of mode MODE.  WIN will be a C statement label elsewhere
  513.      in the code.  It is not necessary to define this macro, but it
  514.      might be useful for performance reasons.
  515.  
  516.      For example, on the i386, it is sometimes possible to use a single
  517.      reload register instead of two by reloading a sum of two pseudo
  518.      registers into a register.  On the other hand, for number of RISC
  519.      processors offsets are limited so that often an intermediate
  520.      address needs to be generated in order to address a stack slot.
  521.      By defining LEGITIMIZE_RELOAD_ADDRESS appropriately, the
  522.      intermediate addresses generated for adjacent some stack slots can
  523.      be made identical, and thus be shared.
  524.  
  525.      *Note*: This macro should be used with caution.  It is necessary
  526.      to know something of how reload works in order to effectively use
  527.      this, and it is quite easy to produce macros that build in too
  528.      much knowledge of reload internals.
  529.  
  530.      *Note*: This macro must be able to reload an address created by a
  531.      previous invocation of this macro.  If it fails to handle such
  532.      addresses then the compiler may generate incorrect code or abort.
  533.  
  534.      The macro definition should use `push_reload' to indicate parts
  535.      that need reloading; OPNUM, TYPE and IND_LEVELS are usually
  536.      suitable to be passed unaltered to `push_reload'.
  537.  
  538.      The code generated by this macro must not alter the substructure of
  539.      X.  If it transforms X into a more legitimate form, it should
  540.      assign X (which will always be a C variable) a new value.  This
  541.      also applies to parts that you change indirectly by calling
  542.      `push_reload'.
  543.  
  544.      The macro definition may use `strict_memory_address_p' to test if
  545.      the address has become legitimate.
  546.  
  547.      If you want to change only a part of X, one standard way of doing
  548.      this is to use `copy_rtx'.  Note, however, that is unshares only a
  549.      single level of rtl.  Thus, if the part to be changed is not at the
  550.      top level, you'll need to replace first the top leve It is not
  551.      necessary for this macro to come up with a legitimate address;
  552.      but often a machine-dependent strategy can generate better code.
  553.  
  554. `GO_IF_MODE_DEPENDENT_ADDRESS (ADDR, LABEL)'
  555.      A C statement or compound statement with a conditional `goto
  556.      LABEL;' executed if memory address X (an RTX) can have different
  557.      meanings depending on the machine mode of the memory reference it
  558.      is used for or if the address is valid for some modes but not
  559.      others.
  560.  
  561.      Autoincrement and autodecrement addresses typically have
  562.      mode-dependent effects because the amount of the increment or
  563.      decrement is the size of the operand being addressed.  Some
  564.      machines have other mode-dependent addresses.  Many RISC machines
  565.      have no mode-dependent addresses.
  566.  
  567.      You may assume that ADDR is a valid address for the machine.
  568.  
  569. `LEGITIMATE_CONSTANT_P (X)'
  570.      A C expression that is nonzero if X is a legitimate constant for
  571.      an immediate operand on the target machine.  You can assume that X
  572.      satisfies `CONSTANT_P', so you need not check this.  In fact, `1'
  573.      is a suitable definition for this macro on machines where anything
  574.      `CONSTANT_P' is valid.
  575.  
  576. 
  577. File: gcc.info,  Node: Condition Code,  Next: Costs,  Prev: Addressing Modes,  Up: Target Macros
  578.  
  579. Condition Code Status
  580. =====================
  581.  
  582.    This describes the condition code status.
  583.  
  584.    The file `conditions.h' defines a variable `cc_status' to describe
  585. how the condition code was computed (in case the interpretation of the
  586. condition code depends on the instruction that it was set by).  This
  587. variable contains the RTL expressions on which the condition code is
  588. currently based, and several standard flags.
  589.  
  590.    Sometimes additional machine-specific flags must be defined in the
  591. machine description header file.  It can also add additional
  592. machine-specific information by defining `CC_STATUS_MDEP'.
  593.  
  594. `CC_STATUS_MDEP'
  595.      C code for a data type which is used for declaring the `mdep'
  596.      component of `cc_status'.  It defaults to `int'.
  597.  
  598.      This macro is not used on machines that do not use `cc0'.
  599.  
  600. `CC_STATUS_MDEP_INIT'
  601.      A C expression to initialize the `mdep' field to "empty".  The
  602.      default definition does nothing, since most machines don't use the
  603.      field anyway.  If you want to use the field, you should probably
  604.      define this macro to initialize it.
  605.  
  606.      This macro is not used on machines that do not use `cc0'.
  607.  
  608. `NOTICE_UPDATE_CC (EXP, INSN)'
  609.      A C compound statement to set the components of `cc_status'
  610.      appropriately for an insn INSN whose body is EXP.  It is this
  611.      macro's responsibility to recognize insns that set the condition
  612.      code as a byproduct of other activity as well as those that
  613.      explicitly set `(cc0)'.
  614.  
  615.      This macro is not used on machines that do not use `cc0'.
  616.  
  617.      If there are insns that do not set the condition code but do alter
  618.      other machine registers, this macro must check to see whether they
  619.      invalidate the expressions that the condition code is recorded as
  620.      reflecting.  For example, on the 68000, insns that store in address
  621.      registers do not set the condition code, which means that usually
  622.      `NOTICE_UPDATE_CC' can leave `cc_status' unaltered for such insns.
  623.      But suppose that the previous insn set the condition code based
  624.      on location `a4@(102)' and the current insn stores a new value in
  625.      `a4'.  Although the condition code is not changed by this, it will
  626.      no longer be true that it reflects the contents of `a4@(102)'.
  627.      Therefore, `NOTICE_UPDATE_CC' must alter `cc_status' in this case
  628.      to say that nothing is known about the condition code value.
  629.  
  630.      The definition of `NOTICE_UPDATE_CC' must be prepared to deal with
  631.      the results of peephole optimization: insns whose patterns are
  632.      `parallel' RTXs containing various `reg', `mem' or constants which
  633.      are just the operands.  The RTL structure of these insns is not
  634.      sufficient to indicate what the insns actually do.  What
  635.      `NOTICE_UPDATE_CC' should do when it sees one is just to run
  636.      `CC_STATUS_INIT'.
  637.  
  638.      A possible definition of `NOTICE_UPDATE_CC' is to call a function
  639.      that looks at an attribute (*note Insn Attributes::.) named, for
  640.      example, `cc'.  This avoids having detailed information about
  641.      patterns in two places, the `md' file and in `NOTICE_UPDATE_CC'.
  642.  
  643. `EXTRA_CC_MODES'
  644.      A list of names to be used for additional modes for condition code
  645.      values in registers (*note Jump Patterns::.).  These names are
  646.      added to `enum machine_mode' and all have class `MODE_CC'.  By
  647.      convention, they should start with `CC' and end with `mode'.
  648.  
  649.      You should only define this macro if your machine does not use
  650.      `cc0' and only if additional modes are required.
  651.  
  652. `EXTRA_CC_NAMES'
  653.      A list of C strings giving the names for the modes listed in
  654.      `EXTRA_CC_MODES'.  For example, the Sparc defines this macro and
  655.      `EXTRA_CC_MODES' as
  656.  
  657.           #define EXTRA_CC_MODES CC_NOOVmode, CCFPmode, CCFPEmode
  658.           #define EXTRA_CC_NAMES "CC_NOOV", "CCFP", "CCFPE"
  659.  
  660.      This macro is not required if `EXTRA_CC_MODES' is not defined.
  661.  
  662. `SELECT_CC_MODE (OP, X, Y)'
  663.      Returns a mode from class `MODE_CC' to be used when comparison
  664.      operation code OP is applied to rtx X and Y.  For example, on the
  665.      Sparc, `SELECT_CC_MODE' is defined as (see *note Jump Patterns::.
  666.      for a description of the reason for this definition)
  667.  
  668.           #define SELECT_CC_MODE(OP,X,Y) \
  669.             (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT          \
  670.              ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode)    \
  671.              : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS    \
  672.                  || GET_CODE (X) == NEG) \
  673.                 ? CC_NOOVmode : CCmode))
  674.  
  675.      You need not define this macro if `EXTRA_CC_MODES' is not defined.
  676.  
  677. `CANONICALIZE_COMPARISON (CODE, OP0, OP1)'
  678.      One some machines not all possible comparisons are defined, but
  679.      you can convert an invalid comparison into a valid one.  For
  680.      example, the Alpha does not have a `GT' comparison, but you can
  681.      use an `LT' comparison instead and swap the order of the operands.
  682.  
  683.      On such machines, define this macro to be a C statement to do any
  684.      required conversions.  CODE is the initial comparison code and OP0
  685.      and OP1 are the left and right operands of the comparison,
  686.      respectively.  You should modify CODE, OP0, and OP1 as required.
  687.  
  688.      GNU CC will not assume that the comparison resulting from this
  689.      macro is valid but will see if the resulting insn matches a
  690.      pattern in the `md' file.
  691.  
  692.      You need not define this macro if it would never change the
  693.      comparison code or operands.
  694.  
  695. `REVERSIBLE_CC_MODE (MODE)'
  696.      A C expression whose value is one if it is always safe to reverse a
  697.      comparison whose mode is MODE.  If `SELECT_CC_MODE' can ever
  698.      return MODE for a floating-point inequality comparison, then
  699.      `REVERSIBLE_CC_MODE (MODE)' must be zero.
  700.  
  701.      You need not define this macro if it would always returns zero or
  702.      if the floating-point format is anything other than
  703.      `IEEE_FLOAT_FORMAT'.  For example, here is the definition used on
  704.      the Sparc, where floating-point inequality comparisons are always
  705.      given `CCFPEmode':
  706.  
  707.           #define REVERSIBLE_CC_MODE(MODE)  ((MODE) != CCFPEmode)
  708.  
  709. 
  710. File: gcc.info,  Node: Costs,  Next: Sections,  Prev: Condition Code,  Up: Target Macros
  711.  
  712. Describing Relative Costs of Operations
  713. =======================================
  714.  
  715.    These macros let you describe the relative speed of various
  716. operations on the target machine.
  717.  
  718. `CONST_COSTS (X, CODE, OUTER_CODE)'
  719.      A part of a C `switch' statement that describes the relative costs
  720.      of constant RTL expressions.  It must contain `case' labels for
  721.      expression codes `const_int', `const', `symbol_ref', `label_ref'
  722.      and `const_double'.  Each case must ultimately reach a `return'
  723.      statement to return the relative cost of the use of that kind of
  724.      constant value in an expression.  The cost may depend on the
  725.      precise value of the constant, which is available for examination
  726.      in X, and the rtx code of the expression in which it is contained,
  727.      found in OUTER_CODE.
  728.  
  729.      CODE is the expression code--redundant, since it can be obtained
  730.      with `GET_CODE (X)'.
  731.  
  732. `RTX_COSTS (X, CODE, OUTER_CODE)'
  733.      Like `CONST_COSTS' but applies to nonconstant RTL expressions.
  734.      This can be used, for example, to indicate how costly a multiply
  735.      instruction is.  In writing this macro, you can use the construct
  736.      `COSTS_N_INSNS (N)' to specify a cost equal to N fast
  737.      instructions.  OUTER_CODE is the code of the expression in which X
  738.      is contained.
  739.  
  740.      This macro is optional; do not define it if the default cost
  741.      assumptions are adequate for the target machine.
  742.  
  743. `DEFAULT_RTX_COSTS (X, CODE, OUTER_CODE)'
  744.      This macro, if defined, is called for any case not handled by the
  745.      `RTX_COSTS' or `CONST_COSTS' macros.  This eliminates the need to
  746.      put case labels into the macro, but the code, or any functions it
  747.      calls, must assume that the RTL in X could be of any type that has
  748.      not already been handled.  The arguments are the same as for
  749.      `RTX_COSTS', and the macro should execute a return statement giving
  750.      the cost of any RTL expressions that it can handle.  The default
  751.      cost calculation is used for any RTL for which this macro does not
  752.      return a value.
  753.  
  754.      This macro is optional; do not define it if the default cost
  755.      assumptions are adequate for the target machine.
  756.  
  757. `ADDRESS_COST (ADDRESS)'
  758.      An expression giving the cost of an addressing mode that contains
  759.      ADDRESS.  If not defined, the cost is computed from the ADDRESS
  760.      expression and the `CONST_COSTS' values.
  761.  
  762.      For most CISC machines, the default cost is a good approximation
  763.      of the true cost of the addressing mode.  However, on RISC
  764.      machines, all instructions normally have the same length and
  765.      execution time.  Hence all addresses will have equal costs.
  766.  
  767.      In cases where more than one form of an address is known, the form
  768.      with the lowest cost will be used.  If multiple forms have the
  769.      same, lowest, cost, the one that is the most complex will be used.
  770.  
  771.      For example, suppose an address that is equal to the sum of a
  772.      register and a constant is used twice in the same basic block.
  773.      When this macro is not defined, the address will be computed in a
  774.      register and memory references will be indirect through that
  775.      register.  On machines where the cost of the addressing mode
  776.      containing the sum is no higher than that of a simple indirect
  777.      reference, this will produce an additional instruction and
  778.      possibly require an additional register.  Proper specification of
  779.      this macro eliminates this overhead for such machines.
  780.  
  781.      Similar use of this macro is made in strength reduction of loops.
  782.  
  783.      ADDRESS need not be valid as an address.  In such a case, the cost
  784.      is not relevant and can be any value; invalid addresses need not be
  785.      assigned a different cost.
  786.  
  787.      On machines where an address involving more than one register is as
  788.      cheap as an address computation involving only one register,
  789.      defining `ADDRESS_COST' to reflect this can cause two registers to
  790.      be live over a region of code where only one would have been if
  791.      `ADDRESS_COST' were not defined in that manner.  This effect should
  792.      be considered in the definition of this macro.  Equivalent costs
  793.      should probably only be given to addresses with different numbers
  794.      of registers on machines with lots of registers.
  795.  
  796.      This macro will normally either not be defined or be defined as a
  797.      constant.
  798.  
  799. `REGISTER_MOVE_COST (FROM, TO)'
  800.      A C expression for the cost of moving data from a register in class
  801.      FROM to one in class TO.  The classes are expressed using the
  802.      enumeration values such as `GENERAL_REGS'.  A value of 2 is the
  803.      default; other values are interpreted relative to that.
  804.  
  805.      It is not required that the cost always equal 2 when FROM is the
  806.      same as TO; on some machines it is expensive to move between
  807.      registers if they are not general registers.
  808.  
  809.      If reload sees an insn consisting of a single `set' between two
  810.      hard registers, and if `REGISTER_MOVE_COST' applied to their
  811.      classes returns a value of 2, reload does not check to ensure that
  812.      the constraints of the insn are met.  Setting a cost of other than
  813.      2 will allow reload to verify that the constraints are met.  You
  814.      should do this if the `movM' pattern's constraints do not allow
  815.      such copying.
  816.  
  817. `MEMORY_MOVE_COST (MODE, CLASS, IN)'
  818.      A C expression for the cost of moving data of mode MODE between a
  819.      register of class CLASS and memory; IN is zero if the value is to
  820.      be written to memory, non-zero if it is to be read in.  This cost
  821.      is relative to those in `REGISTER_MOVE_COST'.  If moving between
  822.      registers and memory is more expensive than between two registers,
  823.      you should define this macro to express the relative cost.
  824.  
  825.      If you do not define this macro, GNU CC uses a default cost of 4
  826.      plus the cost of copying via a secondary reload register, if one is
  827.      needed.  If your machine requires a secondary reload register to
  828.      copy between memory and a register of CLASS but the reload
  829.      mechanism is more complex than copying via an intermediate, define
  830.      this macro to reflect the actual cost of the move.
  831.  
  832.      GNU CC defines the function `memory_move_secondary_cost' if
  833.      secondary reloads are needed.  It computes the costs due to
  834.      copying via a secondary register.  If your machine copies from
  835.      memory using a secondary register in the conventional way but the
  836.      default base value of 4 is not correct for your machine, define
  837.      this macro to add some other value to the result of that function.
  838.      The arguments to that function are the same as to this macro.
  839.  
  840. `BRANCH_COST'
  841.      A C expression for the cost of a branch instruction.  A value of 1
  842.      is the default; other values are interpreted relative to that.
  843.  
  844.    Here are additional macros which do not specify precise relative
  845. costs, but only that certain actions are more expensive than GNU CC
  846. would ordinarily expect.
  847.  
  848. `SLOW_BYTE_ACCESS'
  849.      Define this macro as a C expression which is nonzero if accessing
  850.      less than a word of memory (i.e. a `char' or a `short') is no
  851.      faster than accessing a word of memory, i.e., if such access
  852.      require more than one instruction or if there is no difference in
  853.      cost between byte and (aligned) word loads.
  854.  
  855.      When this macro is not defined, the compiler will access a field by
  856.      finding the smallest containing object; when it is defined, a
  857.      fullword load will be used if alignment permits.  Unless bytes
  858.      accesses are faster than word accesses, using word accesses is
  859.      preferable since it may eliminate subsequent memory access if
  860.      subsequent accesses occur to other fields in the same word of the
  861.      structure, but to different bytes.
  862.  
  863. `SLOW_ZERO_EXTEND'
  864.      Define this macro if zero-extension (of a `char' or `short' to an
  865.      `int') can be done faster if the destination is a register that is
  866.      known to be zero.
  867.  
  868.      If you define this macro, you must have instruction patterns that
  869.      recognize RTL structures like this:
  870.  
  871.           (set (strict_low_part (subreg:QI (reg:SI ...) 0)) ...)
  872.  
  873.      and likewise for `HImode'.
  874.  
  875. `SLOW_UNALIGNED_ACCESS'
  876.      Define this macro to be the value 1 if unaligned accesses have a
  877.      cost many times greater than aligned accesses, for example if they
  878.      are emulated in a trap handler.
  879.  
  880.      When this macro is non-zero, the compiler will act as if
  881.      `STRICT_ALIGNMENT' were non-zero when generating code for block
  882.      moves.  This can cause significantly more instructions to be
  883.      produced.  Therefore, do not set this macro non-zero if unaligned
  884.      accesses only add a cycle or two to the time for a memory access.
  885.  
  886.      If the value of this macro is always zero, it need not be defined.
  887.  
  888. `DONT_REDUCE_ADDR'
  889.      Define this macro to inhibit strength reduction of memory
  890.      addresses.  (On some machines, such strength reduction seems to do
  891.      harm rather than good.)
  892.  
  893. `MOVE_RATIO'
  894.      The threshold of number of scalar memory-to-memory move insns,
  895.      *below* which a sequence of insns  should be generated instead of a
  896.      string move insn or a library call.  Increasing the value will
  897.      always make code faster, but eventually incurs high cost in
  898.      increased code size.
  899.  
  900.      Note that on machines with no memory-to-memory move insns, this
  901.      macro denotes the corresponding number of memory-to-memory
  902.      *sequences*.
  903.  
  904.      If you don't define this, a reasonable default is used.
  905.  
  906. `MOVE_BY_PIECES_P (SIZE, ALIGNMENT)'
  907.      A C expression used to determine whether `move_by_pieces' will be
  908.      used to copy a chunk of memory, or whether some other block move
  909.      mechanism will be used.  Defaults to 1 if `move_by_pieces_ninsns'
  910.      returns less than `MOVE_RATIO'.
  911.  
  912. `MOVE_MAX_PIECES'
  913.      A C expression used by `move_by_pieces' to determine the largest
  914.      unit a load or store used to copy memory is.  Defaults to
  915.      `MOVE_MAX'.
  916.  
  917. `USE_LOAD_POST_INCREMENT (MODE)'
  918.      A C expression used to determine whether a load postincrement is a
  919.      good thing to use for a given mode.  Defaults to the value of
  920.      `HAVE_POST_INCREMENT'.
  921.  
  922. `USE_LOAD_POST_DECREMENT (MODE)'
  923.      A C expression used to determine whether a load postdecrement is a
  924.      good thing to use for a given mode.  Defaults to the value of
  925.      `HAVE_POST_DECREMENT'.
  926.  
  927. `USE_LOAD_PRE_INCREMENT (MODE)'
  928.      A C expression used to determine whether a load preincrement is a
  929.      good thing to use for a given mode.  Defaults to the value of
  930.      `HAVE_PRE_INCREMENT'.
  931.  
  932. `USE_LOAD_PRE_DECREMENT (MODE)'
  933.      A C expression used to determine whether a load predecrement is a
  934.      good thing to use for a given mode.  Defaults to the value of
  935.      `HAVE_PRE_DECREMENT'.
  936.  
  937. `USE_STORE_POST_INCREMENT (MODE)'
  938.      A C expression used to determine whether a store postincrement is
  939.      a good thing to use for a given mode.  Defaults to the value of
  940.      `HAVE_POST_INCREMENT'.
  941.  
  942. `USE_STORE_POST_DECREMENT (MODE)'
  943.      A C expression used to determine whether a store postdeccrement is
  944.      a good thing to use for a given mode.  Defaults to the value of
  945.      `HAVE_POST_DECREMENT'.
  946.  
  947. `USE_STORE_PRE_INCREMENT (MODE)'
  948.      This macro is used to determine whether a store preincrement is a
  949.      good thing to use for a given mode.  Defaults to the value of
  950.      `HAVE_PRE_INCREMENT'.
  951.  
  952. `USE_STORE_PRE_DECREMENT (MODE)'
  953.      This macro is used to determine whether a store predecrement is a
  954.      good thing to use for a given mode.  Defaults to the value of
  955.      `HAVE_PRE_DECREMENT'.
  956.  
  957. `NO_FUNCTION_CSE'
  958.      Define this macro if it is as good or better to call a constant
  959.      function address than to call an address kept in a register.
  960.  
  961. `NO_RECURSIVE_FUNCTION_CSE'
  962.      Define this macro if it is as good or better for a function to call
  963.      itself with an explicit address than to call an address kept in a
  964.      register.
  965.  
  966. `ADJUST_COST (INSN, LINK, DEP_INSN, COST)'
  967.      A C statement (sans semicolon) to update the integer variable COST
  968.      based on the relationship between INSN that is dependent on
  969.      DEP_INSN through the dependence LINK.  The default is to make no
  970.      adjustment to COST.  This can be used for example to specify to
  971.      the scheduler that an output- or anti-dependence does not incur
  972.      the same cost as a data-dependence.
  973.  
  974. `ADJUST_PRIORITY (INSN)'
  975.      A C statement (sans semicolon) to update the integer scheduling
  976.      priority `INSN_PRIORITY(INSN)'.  Reduce the priority to execute
  977.      the INSN earlier, increase the priority to execute INSN later.
  978.      Do not define this macro if you do not need to adjust the
  979.      scheduling priorities of insns.
  980.  
  981.